
//
//  BGEntrustViewController.m
//  bigMall
//
//  Created by ios on 16/7/19.
//  Copyright © 2016年 thinklev. All rights reserved.
//

#import "BGEntrustViewController.h"
#import "BGMyEntrustController.h"
#import "BGFaBuEntrustController.h"
#import "BGLoginViewController.h"
//#import "BGFaBuEntrustController.h"

@interface BGEntrustViewController ()

@end

@implementation BGEntrustViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIBarButtonItem *back = [[UIBarButtonItem alloc] init];
    back.title = @"";
    self.navigationItem.backBarButtonItem = back;
    
    UIBarButtonItem *right = [[UIBarButtonItem alloc] initWithTitle:@"发布" style:UIBarButtonItemStylePlain target:self action:@selector(fabu)];
    self.navigationItem.rightBarButtonItem = right;
    
    self.title = @"我的委托";
    
}
- (void)fabu {
    
    NSString *state = [[NSUserDefaults standardUserDefaults]objectForKey:State];
    
    if ([state isEqualToString:StateValue] ) {
    
    BGFaBuEntrustController *a = [[BGFaBuEntrustController alloc] init];
    self.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:a animated:YES];
        
    } else {
        
        BGLoginViewController *a = [[BGLoginViewController alloc] init];
        self.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:a animated:YES];
        
    }
    
}
- (NSArray <NSString *> *)titles {
        
        return @[@"综合",@"出售",@"采购",@"委托进口",@"全委托"];

}

- (NSInteger)numbersOfChildControllersInPageController:(WMPageController *)pageController {
    
    
    self.menuItemWidth = self.view.frame.size.width / 5;
    self.titleSizeSelected = 19;
    self.titleSizeNormal = 16;
    self.menuViewStyle = WMMenuViewStyleLine;
    self.titleColorNormal = [UIColor blackColor];
    self.titleColorSelected = [UIColor orangeColor];
    self.showOnNavigationBar = NO;
    self.menuHeight = 50;
    self.progressColor = [UIColor orangeColor];
    self.scrollView.scrollEnabled = YES;
    
    return self.titles.count;
}

- (NSString *)pageController:(WMPageController *)pageController titleAtIndex:(NSInteger)index {
    
    return self.titles[index];
}

- (UIViewController *)initializeViewControllerAtIndex:(NSInteger)index {
    
    BGMyEntrustController *a = [[BGMyEntrustController alloc] init];
//    BGFaBuEntrustController *b = [[BGFaBuEntrustController alloc] init];
    a.controllerType = self.controllerType;
    
        
        if (index == 0) {
            
            a.type = @"all";
            
            return a;
            
        }else if (index == 1) {
            
            a.type = @"sell";
            
            return a;
        }else if (index == 2) {
            
            a.type = @"buy";
            
            return a;
        }else if (index == 3) {
            
            a.type = @"imports";
            
            return a;
        }else {
            
            a.type = @"allsad";
            
            return a;
        }

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
